"""
1.用户要备份的文件名
2.test.txt test[备份].txt 拿到新的备份文件名 切割,拼接  test .txt   test.py.txt
3.读取原文件拿到内容 把读取到的内容写入新的文件中
"""
file = input("请输入要备份的文件名：")
index = file.rfind(".")
newName = file[:index]+"[备份]"+file[index:]
# print(newName)
with open(file,"rb") as f:
    content = f.read()
with open(newName,"wb") as f:
    f.write(content)